<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>人员信息</title>
<link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css"></link>
<link rel="stylesheet" type="text/css" href="../ext/resources/css/xtheme-slate.css"></link>
<script src="../ext/adapter/ext/ext-base.js"></script>
<script src="../ext/ext-all.js"></script>
<script src="../ext/src/locale/ext-lang-zh_CN.js"></script>	
<script src="../ext/base/PagingMemoryProxy.js"></script>	
<script type="text/javascript">
			Ext.onReady(function(){
				Ext.Ajax.on('requestcomplete',checkUserSessionStatus, this);      
				function checkUserSessionStatus(conn,response,options){      
				    if(response.getResponseHeader('sessionstatus')){      
				    	parent.location.href='/xdj/index.jsp';   
				    }      
				}  
				Ext.BLANK_IMAGE_URL='ext/resources/images/default/s.gif';
				
				var dutyStore=new Ext.data.JsonStore({
					url:'../base/duty_load',
					autoLoad : true,
					fields:['id','name','remark']
				});
				
				var store=new Ext.data.JsonStore({
				 	url: 'plandl_download',
				 	autoLoad : false,
				    fields: ["lineName",
				             "zoneName",
				             "deviceName",
				             "checkName",
				             "type",
				             "part",
				             "className",
				             "order",
				             "dutyName",
				             "starttime",
				             "endtime"]
				});
				
				var form=new Ext.form.FormPanel({
					frame:true,
					height:100,
					labelAlign:'right',
					//labelWidth:55,
					buttonAlign:'center',
					//columnWidth:.60,
					layout:'column',
					items:[
						{
							layout:'form',
							labelWidth:60,
							items:[{
								fieldLabel:'开始日期',
								id:'startdate',
								width:150,
								xtype:'datefield'
							}]	
						},{
							layout:'form',
							labelWidth:60,
							items:[{
								fieldLabel:'结束日期',
								id:'enddate',
								width:150,
								xtype:'datefield'
							}]	
						},{ layout:'form',
							labelWidth:60,
							items:[{
								xtype:'combo',
								fieldLabel: '巡检值次',
				                hiddenName:'dutyID',
				                emptyText:'--请选择--',
				                forceSelection: true,
				                listWidth: 150,
				                store: dutyStore,
				                valueField:'id',
				                displayField:'name',
				                typeAhead: true,
				                mode: 'local',
				                triggerAction: 'all',
				                selectOnFocus:true,
				                allowBlank:false
							}],
						}],
					buttons:[{
				    	text: "下载",
				        handler:function(){
				        	if ( form.getForm().isValid() ){
				        		var startdate = Ext.getCmp("startdate").getValue();
				        		if(startdate==null||startdate=='') {
				        			startdate = new Date();
				        			startdate.setHours(0, 0, 0, 0);
				        		}
				        		var enddate = Ext.getCmp("enddate").getValue();
				        		if(enddate==null||enddate=='') {
				        			enddate = new Date();
				        			enddate.setHours(0, 0, 0, 0);
				        		}alert(startdate.toDateString()+"#"+enddate.toDateString());
				        		store.load({
				        			params:{
				        				startdate:startdate,
				        				enddate:enddate,
				        				dutyID:form.getForm().findField("dutyID").getValue()
				        				}
				        		});
				        		
				        	}
				       }
				    },{	
				        	hidden:true,
							width:70	
					}]
				});

				 new Ext.Viewport({  
					layout : 'border', // 使用border布局  
					border:false,
					items:[{
						
						region:'center',
						border:false,
						items:[form]
					}]
				 }); 
			});
		</script> 
</head>
<body>
<div id="form" ></div>
</body>
</html>